package com.tf.pemporaryfood.controller;

import com.tf.pemporaryfood.domain.entity.Category;
import com.tf.pemporaryfood.service.CategoryService;
import com.tf.pemporaryfood.util.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 分类表 Controller
 */
@RestController
@RequestMapping("/categories")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @RequestMapping("/list")
    @ResponseBody
    public ApiResult<Void> findCategoriesAll(){
        List<Category> categoryList = categoryService.findCategoriesAll();
        ApiResult result = new ApiResult<>();
        result.setData(categoryList);
        return result;
    }

}
